<script setup>
import Linechart from './components/Linechart.vue'
import { reactive, ref } from 'vue'
const cards = reactive([
  {
    count: 10,
    yesterday_add: 2,
    icon: 'ChatLineRound',
    color: '#eafafa'
  },
  {
    count: 10,
    yesterday_add: 2,
    icon: 'PieChart',
    color: '#e8f0fd'
  },
  {
    count: 10,
    yesterday_add: 2,
    icon: 'Dish',
    color: '#eaf6fc'
  },
  {
    count: 10,
    yesterday_add: 2,
    icon: 'IceCreamRound',
    color: '#f4f6ff'
  },
  {
    count: 10,
    yesterday_add: 2,
    icon: 'Mouse',
    color: '#eaf6fc'
  },
  {
    count: 10,
    yesterday_add: 2,
    icon: 'Watch',
    color: '#f3f4ff'
  },
  {
    count: 10,
    yesterday_add: 2,
    icon: 'Phone',
    color: '#edfaf8'
  },
  {
    count: 10,
    yesterday_add: 2,
    icon: 'Ship',
    color: '#ecf2fd'
  }
])

const Line_select = ref('0')
const Line_date = ref('')

// const options=reactive([])
const options = [
  {
    value: 'today',
    label: '今日数据'
  },
  {
    value: 'yesterday',
    label: '昨日数据'
  }
]

const data_preview = ref('today')
</script>

<template>
  <div>
    <el-card>
      <template #header>
        <span>数据预览</span>
        <el-select
          v-model="data_preview"
          placeholder="Select"
          style="width: 100px; margin-left: 20px"
        >
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </template>
      <el-row>
        <el-col v-for="(item, index) in cards" :key="index" :span="6">
          <el-card class="card_style" :style="{ backgroundColor: item.color }">
            <el-icon class="icon_style">
              <component :is="item.icon"></component>
            </el-icon>

            <div class="header">
              <span>我看过</span>
            </div>
            <div class="main">
              <span style="font-size: 30px">{{ item.count }}</span>
            </div>
            <div class="footer">
              <span>较昨天 +{{ item.yesterday_add }}</span>
            </div>
          </el-card>
        </el-col>
      </el-row>
      <br />
      <br />
      <div>
        <el-card>
          <template #header>
            <!-- <h1 style="width: 200px">近期趋势-我看过</h1> -->
            <!-- <span>上述</span> -->
            <div>
              <el-radio-group v-model="Line_select" style="margin-right: 30px">
                <el-radio-button label="近30天" value="1" />
                <el-radio-button label="近7天" value="2" />
                <el-radio-button label="自定义" value="0" />
              </el-radio-group>
              <el-date-picker
                style="margin-top: 8px"
                v-model="Line_date"
                type="daterange"
                range-separator="-"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
              />
            </div>
          </template>
          <Linechart :propsHeight="'480px'"></Linechart>
        </el-card>
      </div>
    </el-card>
  </div>
</template>

<style lang="scss" scoped>
.icon_style {
  position: absolute;
  font-size: 90px;
  color: #409eff;
  right: 0px;
}

.card_style {
  position: relative;
  margin: 10px;
  // min-height: 100px;

  span {
    font-size: 10px;
  }
}
</style>
